import axios from 'axios'

/** 获取用户列表 请求 */
export const getUserlist = (page = 1, size = 5, keyword) =>
  axios.get('http://localhost:3000/user/list', {
    params: { page, size, keyword }
  })

/** 删除用户 请求 */
export const addUser = addForm =>
  axios.post('http://localhost:3000/user/add', addForm)

/** 重置用户密码 请求 */
export const resetPassword = userId =>
  axios.post('http://localhost:3000/user/resetPassword', { id: userId })

/** 删除用户 请求 */
export const deleteUser = userId =>
  axios.delete(`http://localhost:3000/user/${userId}`)

/** 修改用户角色 请求 */
export const updateCharacter = (character, userId) =>
  axios.post('http://localhost:3000/user/updateCharacter', {
    character,
    userId
  })

/** 获取用户信息 */
export const getInfo = () => axios.get('http://localhost:3000/user/info')
